/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package common.Objects;

/**
 * The object of Category, holds id and name.
 * @author Richard Irons
 */
public class Category {
    private int id;
    private String name;

    /**
     * Default constructor. This constructor initializes id to 0 and name to ""
     */
    public Category() {
        id = -1;
        name = "";
    }
    /**
     * Constructor to initialize id and name to the inputs
     * @param id - Id to set category to
     * @param name - Name to set the category to
     */
    public Category(int id, String name) {
        this.id = id;
        this.name = name;
    }

    /**
     * Get the categorys id
     * @return The category Id
     */
    public int getId() {
        return id;
    }
    /**
     * Sets the categorys id
     * @param id - Id to set the category to.
     */
    public void setId(int id) {
        this.id = id;
    }
    /**
     * Gets the categorys name
     * @return The categorys name
     */
    public String getName() {
        return name;
    }
    /**
     * Sets the categorys name
     * @param name - Name to set the category to.
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * Override the toString function to return the name as the string.
     * @return name
     */
    @Override
    public String toString() {
        if (id > -1) {
            return this.name;
        } else {
            return "";
        }
    }
}
